<include file="Public/head"/>
<body class="no-skin">
<include file="Public/header"/>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <include file="Public/sidebar"/>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <include file="Public/breadcrumbs"/>

            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                <include file="Public/set"/>

                <!-- /section:settings.box -->
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <div class="row">
                            <div class="cf">
                                <a class="btn btn-info" href="{:U('add')}" value="">新增</a>
                            </div>
                            <div class="space-4"></div>
                            <form id="form" method="post" action="{:U('del')}">
                                <table class="table table-striped table-bordered table-hover">
                                    <thead>
                                    <tr>
                                        <th class="center"><input class="check-all" type="checkbox" value=""></th>
                                        <th>菜单名称</th>
                                        <th>链接</th>
                                        <th>传参值</th>
                                        <th>ICON</th>
                                        <th class="center">状态</th>
                                        <th>排序</th>
                                        <th class="center">操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <volist name="list" id="val">
                                        <tr >
                                            <td class="center">
											<empty name="val.children">
                                            <input class="ids" type="checkbox" name="ids[]" value="{$val['id']}">
											</empty>
											<notempty name="val.children">
                                            --
											</notempty>
                                            </td>
                                            <td><div style="position:relative; overflow:hidden;">{$val['title']}<span class="dian" data-id="{$val['id']}" data-type="1" style="cursor:pointer; position:absolute; width:100%; left:0px; text-align:right;">+</span></div></td>
                                            <td>{$val['name']}</td>
                                            <td>{$val['cs']}</td>
                                            <td><i class="{$val.icon}"></i></td>
											<td class="center">
												<if condition="$val['islink'] eq 1 "> 
                                                <a href="{:U('islink',array('id'=>$val['id']))}" title="点击隐藏">显示</a>
												<else />
												<a style="color:#333" href="{:U('islink',array('id'=>$val['id']))}" title="点击显示">隐藏</a>
												</if>
											</td>
                                            <td>{$val['o']}</td>
                                            <td class="center"><a href="{:U('edit',array('id'=>$val['id']))}">修改</a>&nbsp;
											<empty name="val.children">
                                            <a class="del" href="javascript:;" val="{:U('del',array('ids'=>$val['id']))}" title="没有子栏目可直接删除">删除</a>
											</empty>
											</td>
                                        </tr>
                                        <notempty name="val.children">
                                            <volist name="val.children" id="v">
                                                <tr class="toto{$val['id']} aaaaaaaaa">
                                                    <td class="center">
                                                        <input class="ids" type="checkbox" name="ids[]" value="{$v['id']}">
                                                    </td>
                                                    <td>┗━{$v['title']}</td>
                                                    
                                                    <td>{$v['name']}</td>
                                                    <td>{$v['cs']}</td>
                                                    <td><i class="{$v.icon}"></i></td>
													
													
													<td class="center">
														<if condition="$v['islink'] eq 1 "> <a href="{:U('islink',array('id'=>$v['id']))}" title="点击隐藏">显示</a>
														<else />
														<a style="color:#333" href="{:U('islink',array('id'=>$v['id']))}" title="点击显示">隐藏</a>
														</if>
													</td>
													
													
                                                    <td>{$v['o']}</td>
                                                    <td class="center"><a href="{:U('edit',array('id'=>$v['id']))}">修改</a>&nbsp;<a
                                                            class="del" href="javascript:;"
                                                            val="{:U('del',array('ids'=>$v['id']))}" title="删除">删除</a></td>
                                                </tr>
                                                <notempty name="v.children">
                                                    <volist name="v.children" id="vv">
                                                        <tr class="tototo{$val['id']} aaaaaaaaa">
                                                            <td class="center">
                                                                <input class="ids" type="checkbox" name="ids[]"
                                                                       value="{$vv['id']}">
                                                            </td>
                                                            <td>&nbsp;&nbsp;&nbsp;&nbsp;┗━{$vv['title']}</td>
                                                            
                                                            <td>{$vv['name']}</td>
                                                            <td>{$vv['cs']}</td>
                                                            <td><i class="{$vv.icon}"></i></td>
															
															
															<td class="center">
																<if condition="$vv['islink'] eq 1 "> <a href="{:U('islink',array('id'=>$vv['id']))}" title="点击隐藏">显示</a>
																<else />
																<a style="color:#333" href="{:U('islink',array('id'=>$vv['id']))}" title="点击显示">隐藏</a>
																</if>
															</td>
															
															
                                                            <td>{$vv['o']}</td>
                                                            <td class="center"><a
                                                                    href="{:U('edit',array('id'=>$vv['id']))}">修改</a>&nbsp;<a
                                                                    class="del" href="javascript:;"
                                                                    val="{:U('del',array('ids'=>$vv['id']))}" title="删除">删除</a>
                                                            </td>
                                                        </tr>
                                                    </volist>
                                                </notempty>
                                            </volist>
                                        </notempty>
                                    </volist>
                                    </tbody>
                                </table>
                            </form>
                            <div class="cf">
                                <input id="submit" class="btn btn-info" type="button" value="删除">
                            </div>
                            {$page}
                        </div>
                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
    <include file="Public/footer"/>

</div><!-- /.main-container -->

<include file="Public/footerjs"/>
<!-- inline scripts related to this page -->
<script type="text/javascript">
    $(function () {
		
        $(".check-all").click(function () {
            $(".ids").prop("checked", this.checked);
        });
        $(".ids").click(function () {
            var option = $(".ids");
            option.each(function (i) {
                if (!this.checked) {
                    $(".check-all").prop("checked", false);
                    return false;
                } else {
                    $(".check-all").prop("checked", true);
                }
            });
        });
        $("#submit").click(function () {
            bootbox.confirm({
                title: "系统提示",
                message: "确定要删除所选？",
                callback: function (result) {
                    if (result) {
                        $("#form").submit();
                    }
                },
                buttons: {
                    "cancel": {"label": "取消"},
                    "confirm": {
                        "label": "确定",
                        "className": "btn-danger"
                    }
                }
            });
        });
        $(".del").click(function () {
            var url = $(this).attr('val');
            bootbox.confirm({
                title: "系统提示",
                message: "确定要删除?",
                callback: function (result) {
                    if (result) {
                        window.location.href = url;
                    }
                },
                buttons: {
                    "cancel": {"label": "取消"},
                    "confirm": {
                        "label": "确定",
                        "className": "btn-danger"
                    }
                }
            });
        });
		$('.aaaaaaaaa').hide();
		$('.dian').click(function(){
			var othis=$(this),id=$(this).attr('data-id'),type=$(this).attr('data-type');
			if(type==1){
				$('.toto'+id).show();
				$('.tototo'+id).show();
				$(this).text('-');
				$(this).attr('data-type',0);
			}else{
				$('.toto'+id).hide();
				$('.tototo'+id).hide();
				$(this).text('+');
				$(this).attr('data-type',1);
			}
		})
    })
</script>
</body>
</html>
